package com.seventh.associationsystem.controller;

import com.seventh.associationsystem.bean.Activity;
import com.seventh.associationsystem.service.ActivityService;
import com.seventh.associationsystem.service.AssociationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("activity")
public class ActivityController {

    @Autowired
    private ActivityService activityService;

    @Autowired
    private AssociationService associationService;

    @GetMapping("all")
    public List<Activity> getActivities(@RequestParam String uid) {
        return activityService.getActivities(associationService.getByUid(uid));
    }
}
